<?php

require_once('lib/Schedule.php');
require_once('lib/Schedule.php');
require_once('lib/MixiAppliAPI.php');

$api = new MixiAppliAPI(array_merge($_GET, $_POST));

$api->validate_params(array(
    'schedule_id' => array('not_blank', 'is_numeric'),
));

$schedule = new Schedule($api->params['schedule_id']);

if (!$schedule->id)
    $api->set_error('could not load schedule schedule_id: '.$api->params['schedule_id']);

if ($schedule->member_id != $api->viewer_id)
    $api->set_error('member_id: '.$api->viewer_id.' is not owner of schedule schedule_id: '.$api->params['schedule_id']);

if (!$schedule->delete())
    $api->set_error('could not delete schedule schedule_id: '.$api->params['schedule_id']);

$api->set_result(true);

?>
